/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tests;

import hibernateapplication.Main;
import java.util.*;

/**
 *
 * @author mwiatrowski
 */
public class tests_collection {

    public static void main(String[] args) {

        Collection c = new Collection();

        c.arraylist();


    }
}

class Collection {

    private String[] tablica = {"Audi", "BMW", "Volkswagen", "Mercedes", "Skoda", "Łada", "Wartburg", "Moskwicz"};

    public Collection() {
    }

    protected void set() {
        Set set = new HashSet();
        for (String x : tablica) {
            set.add(x);
        }
        int x = 0;
        Iterator itr = set.iterator();
        while (itr.hasNext()) {
            System.out.println(itr.next());
        }
    }

    protected void arraylist() {
        List<String> arraylist = new ArrayList<String>();
        for (String x : tablica) {
            arraylist.add(x);
        }

        for (String x : arraylist) {
            System.out.println(x);
        }

        Iterator itr = arraylist.iterator();

        while (itr.hasNext()) {
            System.out.println(itr.next());
        }
        int i = arraylist.indexOf("BMW");

        System.out.println("Czy znaleziono BMW:: " + i);

    }

    protected void linkedlist() {
        List<String> arraylist = new LinkedList<String>();
        for (String x : tablica) {
            arraylist.add(x);
        }
        
        
        for (String x : arraylist) {
            System.out.println(x);
        }

        Iterator itr = arraylist.iterator();

        while (itr.hasNext()) {
            System.out.println(itr.next());
        }
        int i = arraylist.indexOf("BMW");

        System.out.println("Czy znaleziono BMW:: " + i);

    }
}